/**
 * MessageItem.java 2008-05-16
 * 
 * Linker is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 *
 */

package linker.message;

import javax.swing.JOptionPane;

import linker.list.ListItem;
import linker.list.ViewList; 

/**
 * The item of message which used to add to messagelist.
 * 
 * @version 2008-05-16
 * @author Jianfeng tujf.cn@gmail.com
 * @author Tan tan1986@gmail.com
 * 
 */

public class MessageItem extends ListItem {

	/**
	 * The content of the messageItem.
	 */
	private String message;

	/**
	 * 
	 * @param tempContent
	 *            The messageItem's content.
	 * @param title
	 *            The messageItem's title.
	 */
	public MessageItem(final String tempContent, final String title) {
		this.message = tempContent;

		this.setTitle(title);
		this.setTipText(message);
	}

	/**
	 * The double click.
	 */
	public void doubleClick() {
		JOptionPane.showMessageDialog(null, message, getTitle(),
				JOptionPane.OK_OPTION);
		ViewList.removeMessage(this);
	}

}
